import request from "@/util/request";
import type { FroUser } from "./type";
import type { PageType } from '@/api/type'

enum API {
    FRO_USER_INFO_URL = "",
    FRO_USER_URL = "/front/user",
    FRONT_USER_ENROLL = "/front/user/enroll",
    FRO_USER_PAGE_URL = "/front/user/page"
}

export function reqGetFroUserList(query: object) {
    return request<PageType<FroUser>>({
        url: API.FRO_USER_PAGE_URL,
        method: 'get',
        params: query
    })
}
export function reqCreateFroUser(data: FroUser) {
    return request<FroUser>({
        url: API.FRONT_USER_ENROLL,
        method: 'post',
        data
    })
}
export function reqGetFroUserInfo(userId: string) {
    return request<FroUser>({
        url: API.FRO_USER_URL+"/"+userId,
        method: 'get',
    })
}
export function reqModifyFroUser(data: FroUser) {
    return request<FroUser>({
        url: API.FRO_USER_URL,
        method: 'put',
        data
    })
}
export function reqDeleteFroUser(userId: string) {
    return request<FroUser>({
        url: API.FRO_USER_URL+"/"+userId,
        method: 'delete',
    })
}
